package Work0603;

import java.io.*;
import java.util.Scanner;

/**
 * 8:输入一个文本文件名,求他有多少行
 * 
 * @author Y
 *
 */
public class NumberOfRows {

	public static void main(String[] args) throws IOException {
		Scanner in = new Scanner(System.in);
		System.out.println("输入一个文本文件名:");
		String q = in.next();
		FileReader qw = new FileReader(q);
		BufferedReader a = new BufferedReader(qw);
		int num = 0;
		String tre;
		int y;
		for (y = 0; (tre = a.readLine()) != null; y++) {
			System.out.println(tre);
		}
		a.close();
		System.out.println("一共有" + y + "行");

	}

}
